// 幸存者 无限子弹 插件

string author = "Live";
string pluginName = "SurvivorInfiniteAmmo 幸存者无限子弹插件";
string version = "1.0";

// 插件初始化
void OnPluginInit()
{
    // 设置插件信息
    PluginData::SetAuthor(author);
    PluginData::SetName(pluginName);
    PluginData::SetVersion(version);

    // 加载后提示信息
    ThePresident.InfoFeed("插件:"+pluginName+"| 版本:"+version+"| 作者:"+author,false);

    // 地图开始 
    ThePresident_OnMapStart();
}

// 地图开始
void ThePresident_OnMapStart(){
    // 执行回合开始
    ThePresident_OnRoundStart();
}

// 回合开始
void ThePresident_OnRoundStart(){
    // npc无限子弹
    npcInfiniteAmmo();
}

//------------------------------人机/炮塔无限子弹------------------------------

void npcInfiniteAmmo(){

    //Chat.PrintToChat(all,"开始为NPC补充子弹");
    Schedule::Task( 5 , npcInfiniteAmmo );

    string survivor_riot = "survivor_riot";
	CBaseEntity @entRIOT = FindEntityByClassname( null, survivor_riot );
	while( entRIOT !is null)
	{
		NetProp::SetPropInt(entRIOT,"m_iTurretAmmo",NetProp::GetPropInt(entRIOT,"m_iMaxTurretAmmo"));
		@entRIOT = FindEntityByClassname( entRIOT, survivor_riot );
	}

    string survivor = "survivor";
	CBaseEntity @entSurvivor = FindEntityByClassname( null, survivor );
	while( entSurvivor !is null)
	{
		NetProp::SetPropInt(entSurvivor,"m_iTurretAmmo",NetProp::GetPropInt(entSurvivor,"m_iMaxTurretAmmo"));
		@entSurvivor = FindEntityByClassname( entSurvivor, survivor );
	}
	
	string survivor_turret = "survivor_turret";
	CBaseEntity @entTurret = FindEntityByClassname( null, survivor_turret );
	while( entTurret !is null)
	{
		NetProp::SetPropInt(entTurret,"m_iTurretAmmo",NetProp::GetPropInt(entTurret,"m_iMaxTurretAmmo"));
		@entTurret = FindEntityByClassname( entTurret, survivor_turret );
	}

}
